package storetest;

import storetest.service.Function;

import java.util.Scanner;

public class Index {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true){
            // 在菜单中添加两个新选项
            System.out.println("**********欢迎来到京东商城**********");
            System.out.println("1.添加商品");
            System.out.println("2.查看商品");
            System.out.println("3.查看指定商品");
            System.out.println("4.添加到购物车");
            System.out.println("5.查看购物车");
            System.out.println("6.导出数据到MySQL (.sql)");
            System.out.println("7.导出数据到Excel/CSV (.csv)");
            System.out.println("8.退出");
            System.out.println("*********************************");

            int choice = sc.nextInt();
           // 更新 switch 分支
            switch (choice) {
                case 1 -> Function.storeAdd();
                case 2 -> Function.storeQuery();
                case 3 -> Function.storeQueryById();
                case 4 -> Function.storeAddToCar();
                case 5 -> Function.storeShowCar();
                case 6 -> Function.exportToSQL();
                case 7 -> Function.exportToCSV();  // 新增 CSV 导出
                case 8 -> {
                    System.out.println("欢迎下次光临！");
                    System.exit(0);
                }
                default -> System.out.println("输入错误！");
            }
        }
    }
}
